
function block(mult) {
  console.log("mult",mult)
  return [
    {
      num: -4*mult + '%',
      color:'#34CC5C',
    }, {
      num: -3*mult + '%',
      color:'#31AF55',
    }, {
      num: -2*mult + '%',
      color:'#48D86E',
    }, {
      num: -1*mult + '%',
      color:'#4DD370',
    }, {
      num: '0%',
      color:'#3B3D46',
    }, {
      num: 1*mult + '%',
      color:'#692F34',
    }, {
      num: 2*mult + '%',
      color:'#A5383D',
    }, {
      num: 3*mult + '%',
      color:'#EF3F47',
    }, {
      num: 4*mult + '%',
      color:'#FF383B',
    }
  ]
}


const block2 = [
  {
    num:'10亿',
    color:'#3B3D46',
  }, {
    num:'30亿',
    color:'#685455',
  }, {
    num:'50亿',
    color:'#5F3B3D',
  }, {
    num:'70亿',
    color:'#692F34',
  }, {
    num:'90亿',
    color:'#782128',
  }, {
    num:'110亿',
    color:'#EA8183',
  }, {
    num:'130亿',
    color:'#F8696B',
  }, {
    num:'150亿',
    color:'#FF383B',
  }, {
    num:'170亿',
    color:'#D2080B',
  }
]

 const block3 = [
  {
    num:'250万',
    color:'#3B3D46',
  }, {
    num:'500万',
    color:'#685455',
  }, {
    num:'750万',
    color:'#5F3B3D',
  }, {
    num:'1000万',
    color:'#692F34',
  }, {
    num:'1250万',
    color:'#782128',
  }, {
    num:'1500万',
    color:'#EA8183',
  }, {
    num:'1750万',
    color:'#F8696B',
  }, {
    num:'2000万',
    color:'#FF383B',
  }, {
    num:'2250万',
    color:'#D2080B',
  }
]

const block4 = [
  {
    num:'0.2',
    color:'#3B3D46',
  }, {
    num:'0.4',
    color:'#685455',
  }, {
    num:'0.6',
    color:'#5F3B3D',
  }, {
    num:'0.8',
    color:'#692F34',
  }, {
    num:'1.0',
    color:'#782128',
  }, {
    num:'1.2',
    color:'#EA8183',
  }, {
    num:'1.4',
    color:'#F8696B',
  }, {
    num:'1.6',
    color:'#FF383B',
  }, {
    num:'1.8',
    color:'#D2080B',
  }
]


export function blockColor(type) {
  console.log("type",type);
  if(type == 'marketVal' || type == 'flowVal') return block2;
  if(type == 'tradeVolumeMonth3' || type == 'tradeVolume') return block3;
  if(type == 'priceChg') return block(1);
  if(type == 'priceChgWeek') return block(2);
  if(type == 'priceChgMonth') return block(3);
  if(type == 'priceChgMonth3') return block(6);
  if(type == 'priceChgMonth6' || type == 'priceChgThisYear') return block(8);
  if(type == 'priceChgYear') return block(9);
  if(type == 'tradeVolumeRelative') return block4;

  
}



export function colorType(type,val){
  if(type == 'priceChg') return selectColor(val,1);
  if(type == 'priceChgWeek') return selectColor(val,2);
  if(type == 'priceChgMonth') return selectColor(val,3);
  if(type == 'priceChgMonth3') return selectColor(val,6);
  if(type == 'priceChgMonth6' || type == 'priceChgThisYear') return selectColor(val,8);
  if(type == 'priceChgYear') return selectColor(val,9);
  if(type == 'tradeVolumeMonth3' || type == 'tradeVolume') return selectColor2(val);
  if(type == 'marketVal' || type == 'flowVal') return selectColor1(val);
  if(type == 'tradeVolumeRelative' ) return selectColor3(val)

}

/**
 * 
 * @param {*} value 
 * @param {*} mult 倍数
 * 
 * 涨跌幅 priceChg 1 
 * 1周 priceChgWeek *2 
 * 1月 priceChgMonth *3
 * 3月 priceChgMonth3 *6
 * 6月 priceChgMonth6 今年涨跌幅 priceChgThisYear  *8
 * 12月 priceChgYear *9
 */

 function selectColor(value,mult) {
  value = Number(value);
  // console.log(value,mult)
  if (value < -3.5) {
    return "#34CC5C";
  } else if (value >= (-3.5 * mult) && value < (-2.5*mult)) {
    return "#31AF55";
  } else if (value >= (-2.5* mult) && value <(-1.5 * mult)) {
    return "#48D86E";
  } else if (value >= (-1.5* mult) && value <(-0.5* mult) ) {
    return "#4DD370";
  } else if (value >=(-0.5* mult) && value < (0.5 * mult) ) {
    return "#3B3D46";
  } else if (value >= (0.5* mult) && value < (1.5* mult)) {
    return "#692F34";
  } else if (value >= (1.5* mult) && value < (2.5* mult) ) {
    return "#A5383D";
  } else if (value >= (2.5* mult) && value < (3.5* mult) ) {
    return "#EF3F47";
  } else if (value >= (3.5* mult )) {
    return "#FF383B";
  }
}
//总市值 marketVal 流通市值 flowVal （亿）
 function selectColor1(value) {
  value = Number(value);
  if (value < 10) {
    return "#3B3D46";
  } else if (value < 30 && value >= 10) {
    return "#685455";
  } else if (value < 50 && value >= 30 ) {
    return "#5F3B3D";
  } else if (value < 70 && value >= 50 ) {
    return "#692F34";
  } else if (value < 90 && value >= 70) {
    return "#782128";
  } else if (value < 110 && value >= 90 ) {
    return "#EA8183";
  } else if (value < 130 && value >= 110 ) {
    return "#F8696B";
  } else if (value < 150 && value >= 130) {
    return "#FF383B";
  } else if (value >= 150) {
    return "#D2080B";
  }
}
//成交量 tradeVolume   历史成交量 tradeVolumeMonth3  （万） 
 function selectColor2(value) {
   
  value = Number(value);
  if (value < 250) {
    return "#3B3D46";
  } else if (value < 500 && value >= 250) {
    return "#685455";
  } else if (value < 750 && value >= 500 ) {
    return "#5F3B3D";
  } else if (value < 1000 && value >= 750 ) {
    return "#692F34";
  } else if (value < 1250 && value >= 1000) {
    return "#782128";
  } else if (value < 1500 && value >= 1250 ) {
    return "#EA8183";
  } else if (value < 1750 && value >= 1500 ) {
    return "#F8696B";
  } else if (value < 2000 && value >= 1750) {
    return "#FF383B";
  } else if (value >= 2000) {
    return "#D2080B";
  }
}

//tradeVolumeRelative  相对成交量

function selectColor3(value) {
  value = Number(value);
  if (value < 0.2) {
    return "#3B3D46";
  } else if (value < 0.4 && value >= 0.2) {
    return "#685455";
  } else if (value < 0.6 && value >= 0.4 ) {
    return "#5F3B3D";
  } else if (value < 0.8 && value >= 0.6 ) {
    return "#692F34";
  } else if (value < 1 && value >= 0.8) {
    return "#782128";
  } else if (value < 1.2 && value >= 1 ) {
    return "#EA8183";
  } else if (value < 1.4 && value >= 1.2 ) {
    return "#F8696B";
  } else if (value < 1.6 && value >= 1.4) {
    return "#FF383B";
  } else if (value >= 1.6) {
    return "#D2080B";
  }
}

//选股策略

export const XGCL = [
  {name:'全部',val:''},
  {name:'先锋1号',val:'poolXF_1'},
  {name:'先锋2号',val:'poolXF_2'},
  {name:'急先锋',val:'poolXF_0'},
  {name:'巴菲特策略1号',val:'poolHX_BUFFET1'},
  {name:'菲利普·费雪策略1号',val:'poolHX_PHILIP1'},
  {name:'戴维斯双击策略2号',val:'poolHX_DAVIS2'},
  {name:'格雷厄姆稳定策略1号',val:'poolHX_GRAHAM1'},
  {name:'大卫.德瑞曼价值回归策略1号',val:'poolHX_DAVID1'},
  {name:'超跌反弹',val:'poolHX_DROPBOUN'},
  {name:'黄金KDJ',val:'poolHX_GOLDKDJ'},
  {name:'跳空向上',val:'poolHX_JUMPUP'},
  {name:'多头突破',val:'poolHX_MUCHBULLUP'},
  {name:'MACD金叉',val:'poolHX_MACDGOLD'},
  {name:'震荡上升',val:'poolHX_SHOCKRISE'},
]